package io.renren.service.impl;

import io.renren.dao.SysUserDao;
import io.renren.entity.SysUserEntity;
import io.renren.service.SysUserRoleService;
import io.renren.service.SysUserService;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.apache.shiro.crypto.hash.Sha256Hash;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;



/**
 * 系统用户
 * 
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2016年9月18日 上午9:46:09
 */
@Service("sysUserService")
public class SysUserServiceImpl implements SysUserService {
//	@Autowired
//	private SysUserDao sysUserDao;
//	@Autowired
//	private SysUserRoleService sysUserRoleService;

	@Override
	public List<String> queryAllPerms(Long userId) {
		return null;
	}

	@Override
	public List<Long> queryAllMenuId(Long userId) {
		return null;
	}

	@Override
	public SysUserEntity queryByUserName(String username) {
		SysUserEntity userVO = new SysUserEntity();
		userVO.setUserId(1L);
		userVO.setUsername("admin");
		userVO.setPassword("8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918");
		userVO.setCompanyId(null);
		userVO.setMobile("13612345678");
		userVO.setEmail("root@renren.io");
		List<Long> roleIdList = new ArrayList<Long>();
		userVO.setRoleIdList(roleIdList);
		userVO.setStatus(1);
//		userVO=sysUserDao.queryByUserName(username);
		return userVO;
	}
	
	@Override
	public SysUserEntity queryObject(Long userId) {
		SysUserEntity userVO = new SysUserEntity();
		userVO.setUserId(1L);
		userVO.setUsername("admin");
		userVO.setPassword("8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918");
		userVO.setCompanyId(null);
		userVO.setMobile("13612345678");
		userVO.setEmail("root@renren.io");
		List<Long> roleIdList = new ArrayList<Long>();
		userVO.setRoleIdList(roleIdList);
		userVO.setStatus(1);
//		userVO=sysUserDao.queryObject(userId)
		return userVO;
	}

	@Override
	public List<SysUserEntity> queryList(Map<String, Object> map){
		return null;
	}
	
	@Override
	public int queryTotal(Map<String, Object> map) {
		return 0;
	}

	@Override
	@Transactional
	public void save(SysUserEntity user) {
		return;
	}

	@Override
	@Transactional
	public void update(SysUserEntity user) {
		return;
	}

	@Override
	@Transactional
	public void deleteBatch(Long[] userId) {
		return;
	}

	@Override
	public int updatePassword(Long userId, String password, String newPassword) {
		Map<String, Object> map = new HashMap<>();
		map.put("userId", userId);
		map.put("password", password);
		map.put("newPassword", newPassword);
		return 0;
	}
}
